﻿using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Reflection;
using System.Text;
using System.Windows.Forms;

namespace SMSTasker
{
    public partial class ContactItem : UserControl
    {
        public Color SelectedColor = Color.FromArgb(128, 128, 128);
        public Color UnSelectedColor = Color.White;
        public Color SelectedFontColor = Color.White;
        public Color UnSelectedFontColor = Color.Black;
        public Point Scales = Point.Empty;

        public Bitmap icon = null;
        public Bitmap icon_sel = null;

        public String ContactName
        {
            get {
                return lbName.Text;
            }
            set {
                lbName.Text = value;
            }
        }

        public String ContactPhone
        {
            get
            {
                return lbPhone.Text;
            }
            set
            {
                lbPhone.Text = value;
            }
        }

        public ContactItem(String contName, String contPhone)
        {
            InitializeComponent();
            this.ContactName = contName;
            this.ContactPhone = contPhone;
            icon = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("SMSTasker.Resources.ico.png"));
            icon_sel = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("SMSTasker.Resources.ico_sel.png"));
        }

        protected override void OnPaintBackground(PaintEventArgs e)
        {
            e.Graphics.FillRectangle(new SolidBrush(this.BackColor), new Rectangle(0, 0, this.Width, this.Height));
            if (this.BackColor == this.SelectedColor)
            {
                e.Graphics.DrawImage(icon_sel, new Rectangle(1 * Scales.X, 2 * Scales.Y, icon_sel.Width * Scales.X, icon_sel.Height * Scales.Y), new Rectangle(0, 0, icon_sel.Width, icon_sel.Height), GraphicsUnit.Pixel);
            }
            else
            {
                e.Graphics.DrawImage(icon, new Rectangle(1 * Scales.X, 2 * Scales.Y, icon.Width * Scales.X, icon.Height * Scales.Y), new Rectangle(0, 0, icon.Width, icon.Height), GraphicsUnit.Pixel);
            }
            //base.OnPaintBackground(e);
        }
    }
}
